import AutoTable from '@/components/AutoTable';
import { useState } from 'react';
import { Avatar } from 'antd';

function Users({ item }) {
    const [pwd, setPwd] = useState(null);

    const columns = [
        {
            title: '头像',
            dataIndex: 'headUrl',
            key: 'headUrl',
            render: (text) => {
                return <Avatar src={text} alt="" > - </Avatar>;
            },
            search: false,
            width: 66,
        },
        {
            title: '用户名',
            dataIndex: 'name',
            key: 'name',
        },
        {
            title: '账号',
            dataIndex: 'userName',
            key: 'userName',
        },
        {
            title: '手机号',
            dataIndex: 'telephone',
            key: 'telephone',
            width: 120,
        },
        {
            title: '积分',
            dataIndex: 'points',
            key: 'points',
            sorter: (a, b) => a.name.length - b.name.length,
            width: 120,
            search: false
        },
        {
            title: '性别',
            dataIndex: 'sex',
            key: 'sex',
            width: 120,
            search: false,
            render: (text, record) => {
                return record.sex === 1 ? "男" : record.sex === 2 ? "女" : '';
            },
        },
        {
            title: '岗位',
            dataIndex: 'post',
            key: 'post',
            width: 120,
        },
    ];

    const [modal, setModal] = useState({
        open: false,
        footer: false,
        onCancel: () => {
            setModal((s) => ({
                ...s,
                open: false,
            }));
        },
    });
    return (
        <AutoTable
            avatar={true}
            headerTitle="成员列表"
            columns={columns}
            path={'/org/getOrgUserPage/' + item.id}
            method='post'
        ></AutoTable>
    );
}

export default Users;


